home *** CD-ROM | disk | FTP | other *** search
- On 16 Mar 98 07:44:05 GMT, "Jonas Thorell"
- <jonasth@RemoveThisPart.bahnhof.se> wrote:
-
- >Okay, see if someone can help me out here. What I want is to take an ordinary
- >textfile and process in certain ways. What I need to do is to
- >
- >1. Determine how many lines of text it is in it. How?
- >2. Use the above value making a for-loop like
- >
- >For a=1 to <the value mentioned>
- > grab one line of text and insert it in t$(a)
- >next
- >
- >I've tried with input # and line input # but they seem to want to grab the whole
- >text in one chunk.
-
- I am almost sure that your problem is caused by the fact that AMOS
- doesn't see lines the way the OS sees them. AmigaOS (as Unix) thinks a
- line is something terminated by a linefeed. AMOS on the other hand
- sees lines the MS-DOS way: terminated by a carriage return and then a
- linefeed (I am not entirely sure that is the correct order, though).
-
- I believe AMOS has a way of actually setting what the EOL character
- sequence should be. I have never used it, though. I am not sure wether
- this is because the implementation is buggy or because it only works
- one way (writing?). I have always preferred scanning for lines my
- self:
-
- global count
- count = 0
- name$=fsel$("")
- open in 1, name$
- lf=lof(1)
- buffer = 1024
- repeat
- if buffer < lf then buffer = lf
- a$=input$(1,buffer)
- scan[a$,buffer]
- until buffer<=0
- print "number of lines:"; count
-
- procedure count[a$,b]
- for i=1 to b
- if mid$(a$,i,1)=chr$(10) then inc count
- next i
- end proc
-
- Undoubtedly I have omitted a few things or made a few mistakes, but
- this is roughly how it works.
-
- --
- branko collin
- --
- Brought to you from the AMOS Mailinglist!!
-
- mailto: amos-request@access.digex.net Subject: SUBSCRIBE <Email Address>
-
- Posted via Mailinglist Manager V2.10, available soon from
- http://www.mushy-pd.demon.co.uk - the worlds largest AMOS homepages
- Email me at mushypd@redrose.net for more information!
-
-